package com.hc.service.impl;

import com.hc.bean.Pager;
import com.hc.bean.Product;
import com.hc.dao.ProductDao;
import com.hc.service.ProductService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

@Service
@Transactional
public class ProductServiceImpl implements ProductService {
    @Resource
    private ProductDao productDao;
    @Override
    public Boolean addProduct(Product product) {
        if(productDao.addProduct(product)>0)
            return true;
        return false;
    }

    @Override
    public List<Product> fuzzyQuery(Product product) {
        return productDao.fuzzyQuery(product);
    }

    @Override
    public List<Product> fuzzyPagingQuery(Product product, Pager pager) {
        return productDao.fuzzyPagingQuery(product,pager);
    }

    @Override
    public Product getProductById(Integer pid) {
        return productDao.getProductById(pid);
    }
}
